<?php
/**
 * 功能描述：	前端公共部分
 * @datetime	2020-09-28
 * @version   	v1.0
 * @author   	ZHL
 * @copyrigh  	2020 ZHL 版权所有
 */

class Web_BaseModel extends Model {

    /**
     * Notes: 获取上一条下一条记录
     * User: ZhuHaili
     * Date: 2020/9/30
     */
    function prevNextInfo($mould, $menu_id, $id, $status, $flag){
        $where['a.id'] = array($flag, $id);
        if($menu_id){
            $where['a.menu_id'] = $menu_id;
        }
        if($status){
            $where['a.status'] = $status;
        }
        $sql['where'] = $where;
        $sql['field'] = 'a.id,a.id eid,a.title,a.createdate,a.menu_id,m.tmplinfo,m.mould_code';
        $sql['table'] = $mould;
        $sql['as'] = 'a';
        $sql['leftjoin']['sysmenu'] = 'm on a.menu_id=m.id';
        $sql['order'] = 'id desc';
        if($flag == '>'){
            $sql['order'] = 'id asc';
        }
        return $this->conn('mysql')->find($sql);
    }
}